package MR_process.MR2;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

import MR_process.Bean1;

public class Map2 extends Mapper<LongWritable,Text,Text, Bean1> {

    @Override
    protected void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException {
        String line = value.toString();
        String[] words = line.split("\t");
        String word = words[0];
        String doc_id = words[1];
        long count = Long.parseLong(words[2]);
        context.write(new Text(word), new Bean1(word,doc_id,count) );
    }
}
